﻿using System;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using Olitee.WorkScheduler.Enumerations;

namespace Olitee.WorkScheduler.Interfaces
{
    public interface IWorkItem
    {
        /// <summary>
        /// A unique ID number that identifies this work item.
        /// </summary>
        Guid Id { get; }

        /// <summary>
        /// A short string used to pass back messages from the processor (such as success, or error details).
        /// </summary>
        string Message { get; set; }

        /// <summary>
        /// The time the work item was created.
        /// </summary>
        DateTime TimeCreated { get; }

        /// <summary>
        /// The time the work processor began processing the work.
        /// </summary>
        DateTime TimeStarted { get; set; }

        /// <summary>
        /// The time the work processor completed the work.
        /// </summary>
        DateTime TimeCompleted { get; set; }

        /// <summary>
        /// Get the processing time elapsed/total. Returns TimeSpan.Zero if processing has not yet begun.
        /// </summary>
        /// <returns>A TimeSpan object containing the duration.</returns>
        TimeSpan GetProcessingTime();

        /// <summary>
        /// The current status of the work item
        /// </summary>
        WorkItemStatus Status { get; set; }

        /// <summary>
        /// The progress of the work item. If progress isn't supported, then this property should return -1;
        /// </summary>
        double Progress { get; set; }

    }
}
